package com.qigao.mall.web.controller;

import com.qigao.mall.api.ShopInfoService;
import com.qigao.mall.commons.dto.ShopInfoCreateDto;
import com.qigao.mall.commons.dto.ShopInfoDto;
import com.qigao.mall.commons.enums.Result;
import com.qigao.mall.commons.enums.ResultCode;
import com.qigao.mall.web.utils.RequestUtils;
import com.qigao.mall.web.utils.ValidatorUtil;
import com.qigao.mall.web.vo.app.MerShopCreateVo;
import com.qigao.mall.web.vo.app.MerShopModiVo;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Component
public class AbstractShopController {

    private static final Logger logger = LoggerFactory.getLogger(AbstractShopController.class);
    @Resource
    private ShopInfoService shopInfoService;

    //4.按照店铺号查询商户号
    @GetMapping("/findByShopNo/{shopNo}")
    public Result findByShopNo(@PathVariable("shopNo")String shopNo){
        try{
            ShopInfoDto shopInfoDto = shopInfoService.findByShopNo(shopNo);
            if(shopInfoDto ==null){
                return Result.newError(ResultCode.COMMON_DATA_NOT_EXISTS);
            }
            return Result.newSuccess(shopInfoDto);
        }catch (Exception e){
            logger.error("按照店铺号查询商户号发生异常:{}",e);
            return Result.newError(ResultCode.FAIL);
        }
    }

}
